package com.yodawnla.attackTitan2;

import org.anddev.andengine.opengl.texture.region.TiledTextureRegion;

import com.yodawnla.attackTitan2.scene.GameScene;

public class Target extends Fish
{
	public Target(float pX, float pY, TiledTextureRegion pTiledTextureRegion, GameScene scene)
	{
		super(pX, pY, pTiledTextureRegion, scene);
		
		/*YoTimer updateTimer = new YoTimer(0.1f)
		{
			@Override
			public void onTimePassed()
			{
				mScene.getBaseActivity().runOnUpdateThread(new Runnable()
				{
					public void run()
					{
						float pX = Player.this.getX();
						float pY = Player.this.getY();
						int superBound = mScene.getSuperBound();
						if(pX < -superBound)// && mPhyHandler.getVelocityX() < 0)
							mScene.setManSpeed(-pX, mPhyHandler.getVelocityY(), true);
						else if(pX > superBound)// && mPhyHandler.getVelocityX() > 0)
							mScene.setManSpeed(-(pX - superBound), mPhyHandler.getVelocityY(), true);
						
						if(pY < -superBound)// &&  mPhyHandler.getVelocityY() < 0)
							mScene.setManSpeed(mPhyHandler.getVelocityX(), -pY, false);
						else if(pY > superBound)// && mPhyHandler.getVelocityY() > 0)
							mScene.setManSpeed(mPhyHandler.getVelocityX(), -(pY - superBound), true);
						
						ArrayList<Fish> mFishList = mScene.getMFishList();
						for(int i = 0; i < mFishList.size(); i++)
						{
							Giant giant = (Giant)mFishList.get(i);
							if(!giant.isVisible() || giant.getIsDie())
								continue;
							
							if(Player.this.collidesWith(giant.getCollide()))
							{								
								if(mIsPlayer)
								{
									mScene.playSound(SE.hurt);
									float[] centerCoordinates = giant.getSceneCenterCoordinates();
									mScene.setPlayerHurt(Player.this.getX() - centerCoordinates[0], Player.this.getY() - centerCoordinates[1]);
									mScene.reduceHp();
								}
								else
								{
									Player.this.setVisible(false);
									mScene.reduceHumanCount();
//									mScene.addEatCount();
//									if(mFishList.get(i).getIsPlayer())
//										mScene.addHp();
								}
							}
							
							if(mScene.getIsHurt())
								return;
							
							if(Player.this.collidesWith(giant.getLove()))// && Math.abs(getRotation() - giant.getRotation()) < 150)
							{
								mScene.playSound(SE.bite);
								mScene.showAtkEffect(getX(), getY(), getRotation() + 90);
								giant.setIsDie(true);									
							}
						}
					}
				});
			}
		};
		updateTimer.start();*/
	}
}